package com.jy.api.bean;

import com.thoughtworks.xstream.core.BaseException;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by xiaohua on 2018/12/3.
 */

@ControllerAdvice
public class GlobalExceptionHandler {




    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public ResponseEntity handle(BaseException e) {
        return ResponseEntity.ok(e.getMessage());
    }


}
